package com.project.servic.impl;

import com.project.bean.ChannelBean;
import com.project.dao.IChannelDao;
import com.project.dao.PostDao;
import com.project.servic.IChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChannelServiceImpl implements IChannelService {
    @Autowired
    private IChannelDao dao;
    @Autowired
    private PostDao daos;
    @Override
    public List<ChannelBean> findAll() {
        return dao.findAll();
    }

    @Override
    public ChannelBean findById(Integer id) {
        ChannelBean bean= dao.findById(id);
        bean.setPostList(daos.findByPostId(id));
        return bean;
    }
}
